#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
int main()
{
    //实验fork,wait
    printf("111111111\n");
    pid_t pid = fork();
    printf("22222222222222222222222\n");
    if(pid == -1)
    {
        perror("fork failed");
    }
    else if(pid > 0)
    {
        //父进程
        sleep(1);
        printf("父进程,pid=%d\n",getpid());
        printf("子进程,pid=%d\n",pid);
    }
    else if(pid == 0)
    {
        printf("子进程\n");
        printf("my pid =%d,my father pid =%d\n",getpid(),getppid());
    }
    return 0;
    
}
